home *** CD-ROM | disk | FTP | other *** search
/ SuperHack / SuperHack CD.bin / CODING / MISC / BM192A.ZIP / TEXTURES.S < prev    next >
Encoding:
Text File  |  1996-02-23  |  18.8 KB  |  687 lines

  1. *=======================================================*
  2. *    Texture module: latest update 23/02/96        *
  3. *=======================================================*
  4. *    Process, reformat, build & manage textures    *
  5. *=======================================================*
  6.  
  7. max_hash    =    4096        ; maximum number of hash entries
  8. max_textures    =    512        ; maximum number of textures in WAD
  9. max_patches    =    72        ; maximum patches per texture
  10. sky_colour    =    211        ; hack for sky colour
  11. sky_brightness    =    255        ; hack for sky brightness
  12.  
  13. *-------------------------------------------------------*
  14. *    Read & convert texture resource directories    *
  15. *-------------------------------------------------------*
  16. init_textures:
  17. *-------------------------------------------------------*
  18. *    Set up list & resource pointers            *
  19. *-------------------------------------------------------*
  20.     sf        textures_present
  21.     clr.w        texture_count
  22.     clr.w        flat_count
  23.     move.l        #hash_space,hash_array
  24.     move.l        #texture_space,texture_array
  25.     move.l        #texturelist_space,texturelist_array
  26.     move.l        #pnamelist_space,pnamelist_array
  27.     move.l        #flatlist_space,flatlist_array
  28. *-------------------------------------------------------*
  29. *    Read texture directory structures        *
  30. *-------------------------------------------------------*
  31.     bsr        read_pnames
  32.     Cconws        #ascii_readtex1
  33.     lea        ascii_texture1,a0
  34.     bsr        add_textures
  35.     Cconws        #ascii_readtex2
  36.     lea        ascii_texture2,a0
  37.     bsr        add_textures
  38.     tst.b        textures_present
  39.     bne        .cont
  40.     Cconws        #ascii_err_notex
  41.     bra.s        .go
  42. *-------------------------------------------------------*
  43. *    Build hash table for textures            *
  44. *-------------------------------------------------------*
  45. .cont:    move.l        #texture_space,texture_array
  46.     move.l        #texturelist_space,texturelist_array
  47.     bsr        build_texture_hash
  48. *-------------------------------------------------------*
  49. *    Replace wall texture references with indexes    *
  50. *-------------------------------------------------------*
  51. .go:    bsr        fix_sky_textures
  52.     bsr        replace_textures
  53. *-------------------------------------------------------*
  54. *    Replace flat texture references with indexes    *
  55. *-------------------------------------------------------*
  56.     bsr        replace_flats
  57. *-------------------------------------------------------*
  58.     bsr        organise_patches
  59. *-------------------------------------------------------*
  60.     bsr        load_flats
  61. *-------------------------------------------------------*
  62.     Cconws        #ascii_replacedone
  63.     rts
  64.  
  65. *-------------------------------------------------------*
  66. *    Create tracking list for patches        *
  67. *-------------------------------------------------------*
  68. organise_patches:
  69. *-------------------------------------------------------*
  70.     bsr        build_patch_hash
  71.     Cconws        #ascii_locatepatch
  72.     move.l        pname_ptr,a3
  73.     move.l        pnamelist_array,a6
  74.     move.w        pname_count,d7
  75.     bra.s        .go
  76. .all:    move.l        a3,a0
  77.     bsr        locate_patch
  78. ;    tst.l        d0
  79. ;    bne.s        .cont
  80. ;    bsr        entry_missing_w
  81. .cont:    move.l        d0,(a6)+
  82.     addq.l        #8,a3
  83. .go:    dbra        d7,.all
  84.     rts
  85.  
  86. *-------------------------------------------------------*
  87. *    Track down one patch in WAD            *
  88. *-------------------------------------------------------*
  89. locate_patch:    
  90. *-------------------------------------------------------*
  91.     move.l        a0,a1
  92.     bsr        hash_name
  93.     move.l        hash_array,a2
  94.     move.w        #max_hash-1,d4
  95. .find:    and.w        #max_hash-1,d1
  96.     move.l        (a2,d1.w*4),d5
  97.     beq.s        .err
  98.     move.l        d5,a1
  99.     lea        wd_name(a1),a1
  100.     bsr        strcmp_8
  101.     tst.w        d0
  102.     beq.s        .cont
  103.     move.l        d5,d0
  104.     bra.s        .exit
  105. .cont:    addq.w        #1,d1
  106.     dbra        d4,.find
  107. .err:    moveq        #0,d0
  108. .exit:    rts
  109.     
  110. *-------------------------------------------------------*
  111. *    Create hashtable to reduce search overheads    *
  112. *-------------------------------------------------------*
  113. build_patch_hash:
  114. *-------------------------------------------------------*
  115. *    Create hashtable for all valid entries        *
  116. *-------------------------------------------------------*
  117. .cont:    bsr        empty_hash
  118.     move.l        wad_directory,a0
  119.     move.l        wad_entries,d7
  120.     move.l        hash_array,a2
  121.     bra.s        .go
  122. *-------------------------------------------------------*
  123. *    Generate hash index for entry            *
  124. *-------------------------------------------------------*
  125. .all:    lea        wd_name(a0),a1
  126.     bsr        hash_name
  127. *-------------------------------------------------------*
  128. *    Store reference in hash table            *
  129. *-------------------------------------------------------*
  130.     move.w        #max_hash-1,d4
  131. .find:    and.w        #max_hash-1,d1
  132.     tst.l        (a2,d1.w*4)
  133.     beq.s        .slot
  134.     addq.w        #1,d1
  135.     dbra        d4,.find
  136. .slot:    move.l        a0,(a2,d1.w*4)
  137. *-------------------------------------------------------*
  138.     lea        wd_len(a0),a0
  139. .go:    dbra        d7,.all
  140. .exit:    rts
  141.  
  142. *-------------------------------------------------------*
  143. *    Hack to load all floor & ceiling textures    *
  144. *-------------------------------------------------------*
  145. load_flats:
  146. *-------------------------------------------------------*
  147.     Cconws        #ascii_loadflats
  148.     clr.w        flat_index
  149.     moveq        #0,d0
  150.     move.w        flat_count,d0
  151.     move.l        d0,d6
  152.     lsl.l        #8,d0
  153.     lsl.l        #4,d0
  154.     Malloc        d0
  155.     tst.l        d0
  156.     ble        .err
  157.     move.l        d0,a5
  158.     move.l        d0,flat_textures
  159.     move.l        flatlist_array,a6
  160.     bra.s        .go
  161. .loop:    move.l        (a6)+,a4
  162.     cmp.l        #'F_SK',wd_name(a4)
  163.     bne.s        .load
  164.     cmp.w        #'Y1',wd_name+4(a4)
  165.     bne.s        .load
  166.     bsr        fake_flat
  167.     bra.s        .cont
  168. .load:    bsr        read_flat
  169. .cont:    lea        64*64(a5),a5    
  170. .go:    addq.w        #1,flat_index
  171.     dbra        d6,.loop
  172. .err:    rts
  173.  
  174. *-------------------------------------------------------*
  175. *    Load a single flat                *
  176. *-------------------------------------------------------*
  177. read_flat:
  178. *-------------------------------------------------------*
  179.     pushall
  180.     Fseek        wd_offset(a4),wad_handle,#0
  181.     Fread        wad_handle,wd_size(a4),a5
  182.     popall
  183.     rts
  184.  
  185. *-------------------------------------------------------*
  186. *    Hack for sky texture                *
  187. *-------------------------------------------------------*
  188. fake_flat:
  189. *-------------------------------------------------------*
  190.     pushall
  191.     move.w        #(64*64)-1,d0
  192.     move.b        #sky_colour,d1
  193. .clr:    move.b        d1,(a5)+
  194.     dbra        d0,.clr
  195.     popall
  196.     rts
  197.  
  198. *-------------------------------------------------------*
  199. *    Create hashtable to reduce search overheads    *
  200. *-------------------------------------------------------*
  201. build_flat_hash:
  202. *-------------------------------------------------------*
  203. *    Track down 'f_start' & 'f_end' markers        *
  204. *-------------------------------------------------------*
  205.     st        flats_present
  206.     lea        ascii_fstart,a0
  207.     bsr        place_marker
  208.     move.l        wad_mdirectory,flat_start
  209.     tst.w        d0
  210.     beq.s        .err
  211.     lea        ascii_fend,a0
  212.     push.l        wad_directory
  213.     push.l        wad_entries    
  214.     move.l        wad_mdirectory,wad_directory
  215.     move.l        wad_mentries,wad_entries    
  216.     bsr        place_marker
  217.     pop.l        wad_entries
  218.     pop.l        wad_directory
  219.     move.l        wad_mdirectory,flat_end
  220.     tst.w        d0
  221.     bne.s        .cont
  222. .err:    Cconws        #ascii_err_noflats
  223.     sf        flats_present
  224.     bra        .exit
  225. *-------------------------------------------------------*
  226. *    Create hashtable for all valid entries        *
  227. *-------------------------------------------------------*
  228. .cont:    bsr        empty_hash
  229.     move.l        flat_end,d7
  230.     move.l        flat_start,a0
  231.     sub.l        a0,d7
  232.     divu.l        #wd_len,d7
  233.     move.l        hash_array,a2
  234.     move.l        flatlist_array,a3
  235.     moveq        #0,d5
  236.     bra.s        .go
  237. *-------------------------------------------------------*
  238. .all:
  239. *-------------------------------------------------------*
  240.     movem.l        d1-d7/a0-a6,-(sp)
  241.     lea        wd_name(a0),a1
  242.     lea        ascii_sky,a0
  243.     bsr        strcmp_8
  244.     movem.l        (sp)+,d1-d7/a0-a6
  245.     tst.w        d0
  246.     beq.s        .nsky
  247. *-------------------------------------------------------*
  248. *    Keep track of sky index                *
  249. *-------------------------------------------------------*
  250.     move.l        a3,d0
  251.     sub.l        flatlist_array,d0
  252.     lsr.l        #2,d0
  253.     move.w        d0,sky_index
  254. *-------------------------------------------------------*
  255. *    Generate hash index for entry            *
  256. *-------------------------------------------------------*
  257. .nsky:    lea        wd_name(a0),a1
  258.     bsr        hash_name
  259. *-------------------------------------------------------*
  260. *    Store reference in hash table            *
  261. *-------------------------------------------------------*
  262.     move.w        #max_hash-1,d4
  263. .find:    and.w        #max_hash-1,d1
  264.     tst.l        (a2,d1.w*4)
  265.     beq.s        .slot
  266.     addq.w        #1,d1
  267.     dbra        d4,.find
  268. .slot:    move.l        a3,(a2,d1.w*4)
  269. *-------------------------------------------------------*
  270. *    Store index & directory in reference list    *
  271. *-------------------------------------------------------*
  272.     move.l        a0,(a3)+
  273.     addq.w        #1,d5
  274. *-------------------------------------------------------*
  275. .next:    lea        wd_len(a0),a0
  276. .go:    dbra        d7,.all
  277.     move.w        d5,flat_count
  278. .exit:    rts
  279.  
  280. *-------------------------------------------------------*
  281. *    Remove upper / lower names from sky linedefs    *
  282. *-------------------------------------------------------*
  283. fix_sky_textures:
  284. *-------------------------------------------------------*
  285.     Cconws        #ascii_fixsky
  286.     move.l        Line_Array,a2
  287.     move.l        Sector_Array,a4
  288.     move.l        Side_Array,a6
  289.     move.w        NumLines,d7
  290.     bra        .lines
  291. .line:    move.w        linedef_left(a2),d0
  292.     bpl.s        .ok1
  293.     move.w        linedef_right(a2),d0
  294.     bmi        .err
  295. .ok1:    mulu.w        #sidedef_len,d0
  296.     lea        (a6,d0.l),a1            ; left sidedef
  297.     move.w        linedef_right(a2),d0
  298.     bpl.s        .ok2
  299.     move.w        linedef_left(a2),d0
  300. .ok2:    mulu.w        #sidedef_len,d0
  301.     lea        (a6,d0.l),a3            ; right sidedef
  302.     push.l        a6
  303.     move.w        sidedef_sector(a1),d0
  304.     mulu.w        #sector_len,d0
  305.     lea        (a4,d0.l),a6            ; left sector
  306.     move.w        sidedef_sector(a3),d0
  307.     mulu.w        #sector_len,d0
  308.     lea        (a4,d0.l),a5            ; right sector
  309.     cmp.l        #'F_SK',sector_ctns+0(a6)
  310.     bne.s        .skc
  311.     cmp.w        #'Y1',sector_ctns+4(a6)
  312.     bne.s        .skc
  313.     cmp.l        #'F_SK',sector_ctns+0(a5)
  314.     bne.s        .skc
  315.     cmp.w        #'Y1',sector_ctns+4(a5)
  316.     bne.s        .skc
  317.     lea        sidedef_utns(a1),a0
  318.     bsr        clear_name
  319.     lea        sidedef_utns(a3),a0
  320.     bsr        clear_name
  321. .skc:    cmp.l        #'F_SK',sector_ftns+0(a6)
  322.     bne.s        .skf
  323.     cmp.w        #'Y1',sector_ftns+4(a6)
  324.     bne.s        .skf
  325.     cmp.l        #'F_SK',sector_ftns+0(a5)
  326.     bne.s        .skf
  327.     cmp.w        #'Y1',sector_ftns+4(a5)
  328.     bne.s        .skf
  329.     lea        sidedef_ltns(a1),a0
  330.     bsr        clear_name
  331.     lea        sidedef_ltns(a3),a0
  332.     bsr        clear_name
  333. .skf:    pop.l        a6
  334. .err:    lea        linedef_len(a2),a2
  335. .lines:    dbra        d7,.line
  336.     rts
  337.  
  338. *-------------------------------------------------------*
  339. *    Trash texture name                *
  340. *-------------------------------------------------------*
  341. clear_name:
  342. *-------------------------------------------------------*
  343.     move.b        #'~',(a0)+
  344.     clr.b        (a0)+
  345.     clr.w        (a0)+
  346.     clr.l        (a0)+
  347.     rts
  348.  
  349. *-------------------------------------------------------*
  350. *    Replace flat names with quick-index values    *
  351. *-------------------------------------------------------*
  352. replace_flats:
  353. *-------------------------------------------------------*
  354.     bsr        build_flat_hash
  355.     Cconws        #ascii_replaceflat
  356.     move.l        Sector_Array,a3
  357.     move.w        NumSectors,d7
  358.     bra.s        .segs
  359. .seg:    lea        sector_ctns(a3),a0
  360.     bsr.s        replace_flatname
  361.     lea        sector_ftns(a3),a0
  362.     bsr.s        replace_flatname
  363.     lea        sector_len(a3),a3
  364. .segs:    dbra        d7,.seg
  365.     rts
  366.  
  367. *-------------------------------------------------------*
  368. *    Replace flat name with quick-index        *
  369. *-------------------------------------------------------*
  370. replace_flatname:
  371. *-------------------------------------------------------*
  372.     cmp.b        #'-',(a0)
  373.     beq.s        .none
  374.     move.l        a0,a1
  375.     bsr        hash_name
  376.     move.l        hash_array,a2
  377.     move.w        #max_hash-1,d4
  378. .find:    and.w        #max_hash-1,d1
  379.     move.l        (a2,d1.w*4),d5
  380.     beq.s        .err
  381.     move.l        d5,a4
  382.     move.l        (a4),a1
  383.     lea        wd_name(a1),a1
  384.     bsr        strcmp_8
  385.     tst.w        d0
  386.     beq.s        .cont
  387.     sub.l        flatlist_array,d5
  388.     lsr.l        #2,d5
  389.     move.w        d5,(a0)+
  390.     bra.s        .done
  391. .cont:    addq.w        #1,d1
  392.     dbra        d4,.find
  393. .err:    clr.w        (a0)+
  394.     bra.s        .done
  395. .none:    move.w        #-1,(a0)+
  396. .done:    clr.w        (a0)+
  397.     clr.l        (a0)+
  398.     rts
  399.  
  400. *-------------------------------------------------------*
  401. *    Load PNAME resource from WAD            *
  402. *-------------------------------------------------------*
  403. read_pnames:
  404. *-------------------------------------------------------*
  405.     Cconws        #ascii_readpnames
  406.     lea        ascii_pnames,a0
  407.     bsr        load_resource
  408.     tst.l        d0
  409.     beq        err_missing
  410.     imov.l        (a6)+,d0
  411.     move.w        d0,pname_count
  412.     move.l        a6,pname_ptr
  413.     rts
  414.  
  415. *-------------------------------------------------------*
  416. *    Process texture directory            *
  417. *-------------------------------------------------------*
  418. add_textures:
  419. *-------------------------------------------------------*
  420.     bsr        load_resource
  421.     tst.l        d0
  422.     beq.s        .err1
  423.     move.l        a6,resource_ptr
  424.     move.w        texture_count,d5
  425.     move.l        texture_array,a4
  426.     move.l        texturelist_array,a5
  427.     imov.l        (a6)+,d6
  428.     bra.s        .texs
  429. .tex:    imov.l        (a6)+,a0
  430.     add.l        resource_ptr,a0
  431.     addq.w        #1,d5
  432.     bsr        store_texturedef    
  433. .texs:    dbra        d6,.tex
  434.     move.l        a5,texturelist_array
  435.     move.l        a4,texture_array
  436.     move.w        d5,texture_count
  437.     Mfree        resource_ptr
  438.     st        textures_present
  439. .err1:    rts
  440.  
  441. *-------------------------------------------------------*
  442. *    Transfer texture definition to new array    *
  443. *-------------------------------------------------------*
  444. store_texturedef:
  445. *-------------------------------------------------------*
  446.     move.l        a4,(a5)+
  447.     movem.l        wt_name(a0),d0/d1
  448.     movem.l        d0/d1,tex_name(a4)
  449.     move.w        d5,tex_index(a4)
  450.     imov.w        wt_width(a0),tex_width(a4)
  451.     imov.w        wt_height(a0),tex_height(a4)
  452.     imov.w        wt_patches(a0),d1
  453.     move.w        d1,tex_patches(a4)
  454.     lea        wt_len(a0),a0
  455.     lea        tex_len(a4),a4
  456.     bra.s        .copys
  457. .copy:    imov.w        wtp_xoff(a0),texp_xoff(a4)
  458.     imov.w        wtp_yoff(a0),texp_yoff(a4)
  459.     imov.w        wtp_index(a0),texp_index(a4)
  460.     lea        wtp_len(a0),a0
  461.     lea        texp_len(a4),a4
  462. .copys:    dbra        d1,.copy
  463.     rts
  464.  
  465. *-------------------------------------------------------*
  466. *    Create hashtable to reduce search overheads    *
  467. *-------------------------------------------------------*
  468. build_texture_hash:
  469. *-------------------------------------------------------*
  470.     bsr        empty_hash
  471.     move.l        hash_array,a2
  472.     move.l        texturelist_array,a0
  473.     move.w        texture_count,d7
  474.     bra.s        .hashs
  475. .next:    move.l        (a0)+,a1
  476.     move.l        a1,a3
  477.     bsr.s        hash_name
  478.     move.w        #max_hash-1,d4
  479. .find:    and.w        #max_hash-1,d1
  480.     tst.l        (a2,d1.w*4)
  481.     beq.s        .slot
  482.     addq.w        #1,d1
  483.     dbra        d4,.find
  484. .slot:    move.l        a3,(a2,d1.w*4)
  485. .hashs:    dbra        d7,.next
  486.     rts
  487.  
  488. *-------------------------------------------------------*
  489. *    Generate hash index for 8-character name    *
  490. *-------------------------------------------------------*
  491. hash_name:
  492. *-------------------------------------------------------*
  493.     moveq        #0,d1
  494.     moveq        #1,d3
  495.     moveq        #8-1,d2
  496. .all:    moveq        #0,d0
  497.     move.b        (a1)+,d0
  498.     beq.s        .hash
  499.     fixcase        d0
  500.     sub.w        #'0',d0
  501.     muls.w        d3,d0
  502.     add.l        d0,d1
  503.     addq.w        #8,d3
  504.     dbra        d2,.all
  505. .hash:    and.w        #max_hash-1,d1
  506.     rts
  507.     
  508. *-------------------------------------------------------*
  509. *    Replace texture names with quick-index values    *
  510. *-------------------------------------------------------*
  511. replace_textures:        
  512. *-------------------------------------------------------*
  513.     Cconws        #ascii_replacetex
  514.     move.l        Side_Array,a3
  515.     move.w        NumSides,d7
  516.     bra.s        .segs
  517. .seg:    lea        sidedef_utns(a3),a0
  518.     bsr.s        replace_texname
  519.     lea        sidedef_ltns(a3),a0
  520.     bsr.s        replace_texname
  521.     lea        sidedef_mtns(a3),a0
  522.     bsr.s        replace_texname
  523.     lea        sidedef_len(a3),a3
  524. .segs:    dbra        d7,.seg
  525.     rts
  526.  
  527. *-------------------------------------------------------*
  528. *    Replace texture name with quick-index        *
  529. *-------------------------------------------------------*
  530. replace_texname:
  531. *-------------------------------------------------------*
  532.     cmp.b        #'-',(a0)
  533.     beq.s        .none
  534.     cmp.b        #'~',(a0)
  535.     beq.s        .sky
  536.     move.l        a0,a1
  537.     bsr        hash_name
  538.     move.l        hash_array,a2
  539.     move.w        #max_hash-1,d4
  540. .find:    and.w        #max_hash-1,d1
  541.     move.l        (a2,d1.w*4),d0
  542.     beq.s        .err
  543.     move.l        d0,a1
  544.     bsr        strcmp_8
  545.     tst.w        d0
  546.     beq.s        .cont
  547.     move.w        tex_index(a1),(a0)+
  548.     bra.s        .done
  549. .cont:    addq.w        #1,d1
  550.     dbra        d4,.find
  551. .err:    clr.w        (a0)+
  552.     bra.s        .done
  553. .sky:    move.w        #-2,(a0)+
  554.     bra.s        .done
  555. .none:    move.w        #-1,(a0)+
  556. .done:    clr.w        (a0)+
  557.     clr.l        (a0)+
  558.     rts
  559.  
  560. *-------------------------------------------------------*
  561. *    Wipe hashtable                    *
  562. *-------------------------------------------------------*
  563. empty_hash:
  564. *-------------------------------------------------------*
  565.     Cconws        #ascii_hashtex
  566.     move.l        hash_array,a0
  567.     moveq        #0,d1
  568.     move.w        #max_hash-1,d0
  569. .clr:    move.l        d1,(a0)+
  570.     dbra        d0,.clr
  571.     rts
  572.  
  573. *-------------------------------------------------------*
  574. *    Simple mainloop for texture browser        *
  575. *-------------------------------------------------------*
  576. texture_loop:    
  577. *-------------------------------------------------------*
  578.     moveq        #0,d0
  579.     lea        key_buffer,a6
  580.     bra        .tok
  581. .loop:
  582.     ifd        debuggable
  583.     pushall
  584.     bsr        read_key
  585.     popall
  586.     endc
  587.     tst.b        right_key(a6)
  588.     beq.s        .n1
  589.     addq.w        #1,d0
  590.     cmp.w        texture_count,d0
  591.     bmi.s        .tok
  592.     move.w        texture_count,d0
  593.     subq.w        #1,d0
  594. .tok:    pushall
  595.     move.b        #1,refresh
  596.     move.l        ScreenPhy,a0
  597.     bsr        clearscreen
  598.     popall
  599.     bsr        render_texture
  600. .n1:    tst.b        left_key(a6)
  601.     beq.s        .n2
  602.     subq.w        #1,d0
  603.     bpl.s        .ok1
  604.     moveq        #0,d0
  605. .ok1:    pushall
  606.     move.b        #1,refresh
  607.     move.l        ScreenPhy,a0
  608.     bsr        clearscreen
  609.     popall
  610.     bsr        render_texture
  611. .n2:    tst.b        text_key(a6)
  612.     beq        .loop
  613.     rts
  614.  
  615. *-------------------------------------------------------*
  616.             datlong
  617. *-------------------------------------------------------*
  618.  
  619. ascii_texture1:        dc.b    'texture1',0        ; WAD search details
  620. ascii_texture2:        dc.b    'texture2',0
  621. ascii_pnames:        dc.b    'pnames',0
  622. ascii_sky:        dc.b    'f_sky1',0
  623. ascii_fstart:        dc.b    'f_start',0
  624. ascii_fend:        dc.b    'f_end',0
  625. ascii_pstart:        dc.b    'p_start',0
  626. ascii_pend:        dc.b    'p_end',0
  627.  
  628. ascii_readpnames:    dc.b    13,10
  629.             dc.b    ' Reading [pnames] directory...',0
  630. ascii_readtex1:        dc.b    13,10
  631.             dc.b    ' Reading [texture1] directory...',0
  632. ascii_readtex2:        dc.b    13,10
  633.             dc.b    ' Reading [texture2] directory...',0
  634. ascii_hashtex:        dc.b    13,10
  635.             dc.b    ' Generating hashtable...',0
  636. ascii_replacetex:    dc.b    13,10
  637.             dc.b    ' Replacing textures...',0
  638. ascii_replaceflat:    dc.b    13,10
  639.             dc.b    ' Replacing flats...',0
  640. ascii_fixsky:        dc.b    13,10
  641.             dc.b    ' Validating sky sidedefs...',0
  642. ascii_loadflats:    dc.b    13,10
  643.             dc.b    ' Loading flats...',0
  644. ascii_locatepatch:    dc.b    13,10
  645.             dc.b    ' Organising patches...',0
  646. ascii_replacedone:    dc.b    13,10
  647.             dc.b    13,10
  648.             dc.b    ' Finished processing textures.',0
  649.  
  650. *-------------------------------------------------------*
  651.             bsslong
  652. *-------------------------------------------------------*
  653.  
  654. hash_array:        ds.l    1            ; misc texture pointers
  655. flatlist_array:        ds.l    1
  656. texturelist_array:    ds.l    1
  657. texture_array:        ds.l    1
  658. pnamelist_array:    ds.l    1
  659. flat_textures:        ds.l    1
  660. flat_start:        ds.l    1
  661. flat_end:        ds.l    1
  662. patch_start:        ds.l    1
  663. patch_end:        ds.l    1
  664. resource_ptr:        ds.l    1
  665. pname_ptr:        ds.l    1
  666.  
  667. hash_space:        ds.l    max_hash        ; space for texture arrays
  668. flatlist_space:        ds.l    max_textures        ; and quicksearch hashtable
  669. texturelist_space:    ds.l    max_textures
  670. pnamelist_space:    ds.l    max_textures
  671. texture_space:        ds.b    (tex_len+(texp_len*4))*max_textures
  672.  
  673. pname_count:        ds.w    1            ; misc array sizes
  674. texture_count:        ds.w    1            
  675. flat_count:        ds.w    1
  676.  
  677. flat_index:        ds.w    1            ; misc flat index variables
  678. sky_index:        ds.w    1
  679.  
  680. textures_present:    ds.b    1            ; flags for missing resources
  681. flats_present:        ds.b    1
  682. patches_present:    ds.b    1
  683.  
  684. *-------------------------------------------------------*
  685.             txtlong
  686. *-------------------------------------------------------*
  687.